from django.db import models


# Create your models here.
# 超市有不同的类型、名称、货物数量、用户定位等信息   一个超市中，对应有N多商品
class MarketModel(models.Model):
    marketname = models.CharField(max_length=20)
    markettype = models.CharField(max_length=10)
    number = models.IntegerField()
    location = models.CharField(max_length=10)
    # str
    def __str__(self):
        return "超市名称:" + str(self.marketname) + ",类型:" + str(self.markettype)


# 商品有名称、定价、简单介绍、适用人群、进货时间等信息
class ProductModel(models.Model):
    name = models.CharField(max_length=20)
    price = models.FloatField()
    content = models.CharField(max_length=300)
    person = models.CharField(max_length=10)
    intime = models.DateField()
    marketid = models.ForeignKey("MarketModel")
    # str
    def __str__(self):
        return "名称:" + str(self.name)
